#ifndef REWRITE_H
#define REWRITE_H

#include "mlir/IR/Matchers.h"
#include "mlir/IR/PatternMatch.h"
#include "myDialect/toyDialect.h"
#include "myDialect/toyOps.h"
#include <numeric>
using namespace mlir;
using namespace toy;

// class RewriteConstant

struct rewriteAddOp : public mlir::OpRewritePattern<toy::AddOp> {
      /// We register this pattern to match every toy.transpose in the IR.
    /// The "benefit" is used by the framework to order the patterns and process
    /// them in order of profitability.
    rewriteAddOp(mlir::MLIRContext* context) : OpRewritePattern<toy::AddOp>(context) {}

    mlir::LogicalResult matchAndRewrite(AddOp op, mlir::PatternRewriter& rewriter) const override;

};


#endif